﻿using System.Collections.Generic;
using System.Linq;
using AMM.Model;

namespace AMM.DataAccess.Config {
    public class AttachmentRepository : BaseRepository<Attachment> {

        public Attachment FetchAttachmentById(int attachmentId) {
            using (var ctx = this.Context) {
                return ctx.Attachments.Find(attachmentId);
            }
        }

        public List<Attachment> FetchUnLinkedAttchment() {
            using (var ctx = this.Context) {
                return ctx.Attachments.Where(x => x.IsLinked == false).ToList();
            }
        }
    }
}
